﻿using DDD.Application;
using GoodsModule.Domain.GoodsCategoryAggregate;
using GoodsModule.Infrastructure.Queries;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GoodsModule.Application.Queries
{
    public record GoodsCategoryGetLIstRes : IQuery<List<Domain.GoodsCategoryAggregate.GoodsCategory>>;

    public class GoodsCategoryGetLIstQuery(Infrastructure.Queries.GoodsCategoryQuery query)
         : IQueryHandler<GoodsCategoryGetLIstRes, List<Domain.GoodsCategoryAggregate.GoodsCategory>>
    {
        public Task<List<GoodsCategory>> Handle(GoodsCategoryGetLIstRes request, CancellationToken cancellationToken)
        {
            var q = query.AsQueryable();
            return q.ToListAsync(cancellationToken);
        }
    }
}
